
/**
 * Predefined variables
 * Name = aEventBaseManager
 * DateTime = Fri Feb 11 2022 11:18:10 GMT+0800 (中国标准时间)
 * Author = Shioho
 * FileBasename = aEventBaseManager.ts
 * FileBasenameNoExtension = aEventBaseManager
 * URL = db://assets/shioho/scripts/event/api/aEventBaseManager.ts
 * ManualUrl = https://docs.cocos.com/creator/3.4/manual/zh/
 *
 */

import baseEventBus from "../baseEventBus";
import iEventManager from "./iEventManager";

export default abstract class aEventBaseManager<TEvent> implements iEventManager<TEvent> {

    private _eventBus: baseEventBus<TEvent> = new baseEventBus<TEvent>();

    addObserver(eventType: TEvent, observer: Function) {
        this._eventBus.addObserver(eventType, observer);
    }

    removeObserver(eventType: TEvent, observer: Function) {
        this._eventBus.removeObserver(eventType, observer);
    }

    dispatch(eventType: TEvent, ...args: any[]) {
        this._eventBus.dispatch(eventType, args);
    }

    clear() {
        this._eventBus.clear();
    }
}

